﻿this.imagePreview = function () {
    /* CONFIG */

    xOffset = 10;
    yOffset = 30;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

    /* END CONFIG */
    $(".pika-stage img").hover(function (e) {
        $('#pikame').data('pikachoose').Pause();
        this.t = this.title; 
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='preview'><img src='" + $("li.active div img").attr('src2') + "' alt='Image preview' />" + "</p>");
        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function () {
	    //this.title = this.t;
	    $("#preview").remove();
	});
    $(".pika-stage img").mousemove(function (e) {

        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
    $(".pika-stage img").mouseout(function (e) {
        $('#pikame').data('pikachoose').Play();

    });
};


// starting the script on page load
$(document).ready(function () {
    $('#EmailToFriend').click(function () {
        //$(".forminput").slideToggle();
        $('.trSuccessful,#btnClose').hide();
        $('.trInfo,#btnSave').show();
        $('#div1').removeClass('show');
        $('#div2').removeClass('show');
        return false;
    });

    $('.closebtn,#btnClose').click(function () {
        $('#div1').addClass('show');
        $('#div2').addClass('show');
    });
    $('#btnSendToFriend').click(function () {
        $('#div1').addClass('show');
        $('#div2').addClass('show');


        var pData = { FriendEmail: $("#txtFriendEmail").val(), Link: window.location.href};
        //var pData = $.string.Format("CustomerName={0}&Phone={1}&Address={2}&Email={3}", $("#txtName").val(), $("#txtPhone").val(), $("#txtAddress").val(), $("#txtEmail").val()) + "}";
        // var pData = { CustomerName=$("#txtName").val(), Phone: $("#txtPhone").val(), Address: $("#txtAddress").val(), Email: $("#txtEmail").val() };

        $.ajax({
            url: '../Cart/Service/OrderServer.asmx/SendToFriend',
            type: 'POST',
            data: pData,
            cache: false,
            // contentType: "application/json; charset=utf-8",
            // dataType: "json",
            success: function (data, textStatus, jqXHR) {
               // data = $(data).find("string").text();
                
                //overlay.Hide();
            },
            beforeSend: function (jqXHR, settings) {
               

            },
            error: function (jqXHR, textStatus, errorThrown) {
                //overlay.Hide();
            },
            complete: function (XMLHttpRequest, textStatus) {
                //overlay.Hide();
            }
        });


    });
});